package com.chance.cc.crawler.development.bootstrap.autohome.forum;

import com.chance.cc.crawler.core.CrawlerEnum;
import com.chance.cc.crawler.core.downloader.HttpConfig;
import com.chance.cc.crawler.core.filter.FilterUtils;
import com.chance.cc.crawler.core.record.CrawlerRequestRecord;
import com.chance.cc.crawler.development.controller.DevCrawlerController;

/**
 * @author lt
 * @version 1.0
 * @date 2020-11-16 15:47:38
 * @email okprog@sina.com
 */
public class ForumFabuStart {
   // private static final String domain = "autohome_fabu";
    private static final String domain = "autohome";
    public static void main(String[] args) {
        CrawlerRequestRecord requestRecord = CrawlerRequestRecord.builder()
                .startPageRequest(domain,CrawlerEnum.CrawlerRequestType.turnPage)
                //.recordKey("https://www.autohome.com.cn/4080/")
                .httpUrl("https://www.autohome.com.cn/sg26072/")
                .releaseTime(System.currentTimeMillis())
                .httpConfig(HttpConfig.me(domain))
                .domain(domain)
                .filter(CrawlerEnum.CrawlerRecordFilter.keyOrDateRange)
                .addFilterInfo(FilterUtils.memoryFilterKeyInfo(domain))
                .addFilterInfo(FilterUtils.dateRangeFilterInfo(24*3,null))
                .build();

        requestRecord.tagsCreator().bizTags().addSite("praise");
        DevCrawlerController.builder()
                .triggerInfo(domain,domain + "_forum_fabu_trigger",System.currentTimeMillis(),domain+ "_forum_fabu_job")
                .crawlerRequestQueue(DevCrawlerController.devRequestQueue(domain)) //内存队列
                .consoleResultPipeline() //控制台输t出
//                .fileResultPipeline("D:\\chance\\log\\test.log",true)
                .requestRecord(requestRecord)
                .build("com/chance/cc/crawler/development/scripts/autohome")
                .start();
    }
}
